Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the unexpected confirmation dialog in 'Create from *' #6990

Closed
wants to merge 3 commits into from
Closed

Fix the unexpected confirmation dialog in 'Create from *' #6990

wants to merge 3 commits into from

Conversation

xiaoyang-sde
Copy link
Contributor

@xiaoyang-sde xiaoyang-sde commented Apr 9, 2022

The dialog that alerts 'The form has not been submitted yet, do you really want to leave?' (introduced in #6566) will appear even if the user clicked the 'Upload' or 'Deploy' button and the request is successful. This pull request fixes the unexpected confirmation dialog in the 'Create from file', 'Create from form', and 'Create from input' components.

The this.create_.createContent() function navigates to the /overview page before it returns, but the this.creating_ variable will be changed to false after the function returns. Therefore, theCanDeactivateGuard guard will prevent the navigation.

  create(): void {
    this.creating_ = true;
    this.create_
      .createContent(this.file.content, true, this.file.name)
      .then(() => (this.creating_ = false))
      .finally(() => (this.creating_ = false));
  }

The solution is to include a bypassGuard state in the navigation of this.create_.createContent() function to let it bypass the CanDeactivate guard.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 9, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: xiaoyang-sde
To complete the pull request process, please assign jeefy after the PR has been reviewed.
You can assign the PR to them by writing /assign @jeefy in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link

codecov bot commented Apr 9, 2022

Codecov Report

Merging #6990 (956fd3a) into master (58f7b5d) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #6990   +/-   ##
=======================================
  Coverage   41.82%   41.82%           
=======================================
  Files          45       45           
  Lines        1229     1229           
  Branches      161      161           
=======================================
  Hits          514      514           
  Misses        715      715           

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 10, 2022
Signed-off-by: Xiaoyang Liu <siujoeng.lau@gmail.com>
Signed-off-by: Xiaoyang Liu <siujoeng.lau@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 10, 2022
Signed-off-by: Xiaoyang Liu <siujoeng.lau@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants